package test2;

public class PhoneTest {
    public static void main(String[] args) {
        Phone[] array = new Phone[3];

        Phone p1=new Phone("小米","15Pro","白色",5000);
        Phone p2=new Phone("华为","Mate70","蓝色",9000);
        Phone p3=new Phone("苹果","15Plus","黑色",6500);
        array[0]=p1;
        array[1]=p2;
        array[2]=p3;
        int sum=0;
        for(int i=0;i<array.length;i++){
            Phone p=array[i];
            sum=sum+p.getPrice();
        }
        double avg=sum*1.0/array.length;
        System.out.println(avg);
    }
}
